package com.yhn.bean;

import com.yhn.utils.PropertiesUtils;

/**
 * @Author 岳浩楠
 * @Date 2024-05-13 20:58
 * @Version 1.0
 */
public class Constants {

    /**
     * 忽略表的前缀
     */
    public static Boolean IGNORE_TABLE_PREFIX;

    /**
     * 扩展的类的名称
     */
    public static String BEAN_EXPAND_PARAM_NAME;

    /**
     * 扩展的类的String、Date类型扩展的后缀名称
     */
    public static String BEAN_EXPAND_PARAM_STRING_SUFFIX;

    public static String BEAN_EXPAND_PARAM_DATE_START_SUFFIX;

    public static String BEAN_EXPAND_PARAM_DATE_END_SUFFIX;

    public static String AUTHOR_COMMENT;
    /**
     * JsonIgnore 相关配置
     */
    public static String JSONIGONRE_PRO;
    public static String JSONIGONRE_ANNO;
    public static String JSONIGONRE_EXPRESSION;

    /**
     * JsonFormat 相关配置
     */
    public static String JSONFORMAT_ANNO;
    public static String JSONFORMAT_EXPRESSION;

    /**
     * dateTimeformat 相关配置
     */
    public static String DATETIMEFORMAT_ANNO;
    public static String DATETIMEFORMAT_EXPRESSION;

    /**
     * 文件输出地址
     */
    public static String PATH_BASE;

    //public static String PATH_PO;

    public static String PATH_JAVA = "java";

    public static String PATH_RESOURCE = "resources";

    /**
     * 包名
     */
    public static String PACKAGE_BASE;

    public static String PATH_BASE_RESOURCE;


    /**
     * 实体类名
     */
    public static String PACKAGE_BEAN;

    /**
     * 实体类扩展名
     */
    public static String PACKAGE_PARAM;


    /**
     * 实体类的包名
     */
    //public static String BASE_PO;

    public static String PATH_BEAN;

    public static String PACKAGE_UTILS;

    public static String PATH_UTILS;

    public static String PACKAGE_ENUM;

    public static String PATH_ENUM;

    public static String PATH_PARAM;

    public static String PACKAGE_MAPPER;

    public static String PATH_MAPPER;

    public static String BEAN_MAPPER_NAME;

    public static String PATH_MAPPER_XML;

    public static String PACKAGE_SERVICE;

    public static String PATH_SERVICE;

    public static String PACKAGE_SERVICE_IMPL;

    public static String PATH_SERVICE_IMPL;

    public static String PACKAGE_VO;

    public static String PATH_VO;

    public static String PACKAGE_EXCEPTION;

    public static String PATH_EXCEPTION;

    public static String PACKAGE_CONTROLLER;
    public static String PATH_CONTROLLER;

    //package.controller


    /**
     * 声明sql类型
     */
    public final static String[] SQL_DATE_TIIME_TYPES = new String[]{"datetime", "timestamp"};

    public final static String[] SQL_DATE_TYPES = new String[]{"date"};

    public static final String[] SQL_DECIMAL_TYPE = new String[]{"decimal", "double", "float"};

    public static final String[] SQL_STRING_TYPE = new String[]{"char", "varchar", "text", "mediumtext", "longtext"};

    //Integer
    public static final String[] SQL_INTEGER_TYPE = new String[]{"int", "tinyint"};

    //Long
    public static final String[] SQL_LONG_TYPE = new String[]{"bigint"};


    static {
        IGNORE_TABLE_PREFIX = String.valueOf(PropertiesUtils.getProperties("ignore.table.prefix")).equalsIgnoreCase("true") ? true : false;

        BEAN_EXPAND_PARAM_NAME = (String) PropertiesUtils.getProperties("bean.expand.param.name");

        BEAN_EXPAND_PARAM_STRING_SUFFIX = (String) PropertiesUtils.getProperties("bean.expand.param.string.suffix");

        BEAN_EXPAND_PARAM_DATE_START_SUFFIX = (String) PropertiesUtils.getProperties("bean.expand.param.date.start.suffix");

        BEAN_EXPAND_PARAM_DATE_END_SUFFIX = (String) PropertiesUtils.getProperties("bean.expand.param.date.end.suffix");

        AUTHOR_COMMENT = (String) PropertiesUtils.getProperties("author.comment");

        //PATH_BASE = ((String) PropertiesUtils.getProperties("path.base")) + "src/main/" + PATH_JAVA;
        //
        //PACKAGE_BASE = (String) PropertiesUtils.getProperties("package.base");
        //
        //PACKAGE_BEAN = (String) PropertiesUtils.getProperties("package.bean");
        //
        //PACKAGE_PARAM = (String) PropertiesUtils.getProperties("package.param");
        //
        //PATH_PO = (PATH_BASE + "/" + PACKAGE_BASE + "/" + PACKAGE_BEAN).replace(".", "/");
        //
        //BASE_PO = PACKAGE_BASE + "." + PACKAGE_BEAN;


        /**
         *  JsonIgnore 相关配置
         */
        JSONIGONRE_PRO = (String) PropertiesUtils.getProperties("jsonigonre.pro");
        JSONIGONRE_ANNO = (String) PropertiesUtils.getProperties("jsonigonre.anno");
        JSONIGONRE_EXPRESSION = (String) PropertiesUtils.getProperties("jsonigonre.expression");

        /**
         *  JsonFormat 相关配置
         */
        JSONFORMAT_ANNO = (String) PropertiesUtils.getProperties("jsonformat.anno");
        JSONFORMAT_EXPRESSION = (String) PropertiesUtils.getProperties("jsonformat.expression");

        /**
         * DateTimeFormat 相关配置
         */
        DATETIMEFORMAT_ANNO = (String) PropertiesUtils.getProperties("datetimeformat.anno");
        DATETIMEFORMAT_EXPRESSION = (String) PropertiesUtils.getProperties("datetimeformat.expression");


        /**
         *  =========================
         */
        PATH_BASE = ((String) PropertiesUtils.getProperties("path.base")) + "src/main/" + PATH_JAVA;
        PATH_BASE_RESOURCE = ((String) PropertiesUtils.getProperties("path.base")) + "src/main/" + PATH_RESOURCE;

        PACKAGE_BASE = (String) PropertiesUtils.getProperties("package.base");

        PACKAGE_BEAN = PACKAGE_BASE + "." + (String) PropertiesUtils.getProperties("package.bean");

        PATH_BEAN = PATH_BASE + "/" + PACKAGE_BEAN.replace(".", "/");

        PACKAGE_UTILS = PACKAGE_BASE + "." + (String) PropertiesUtils.getProperties("package.utils");

        PATH_UTILS = PATH_BASE + "/" + PACKAGE_UTILS.replace(".", "/");

        PACKAGE_ENUM = PACKAGE_BASE + "." + (String) PropertiesUtils.getProperties("package.enum");

        PATH_ENUM = PATH_BASE + "/" + PACKAGE_ENUM.replace(".", "/");


        PACKAGE_PARAM = PACKAGE_BASE + "." + (String) PropertiesUtils.getProperties("package.param");

        PATH_PARAM = PATH_BASE + "/" + PACKAGE_PARAM.replace(".", "/");


        PACKAGE_MAPPER = PACKAGE_BASE + "." + (String) PropertiesUtils.getProperties("package.mapper");

        PATH_MAPPER = PATH_BASE + "/" + PACKAGE_MAPPER.replace(".", "/");

        BEAN_MAPPER_NAME = (String) PropertiesUtils.getProperties("bean.mapper.name");

        PATH_MAPPER_XML = PATH_BASE_RESOURCE + "/" + PACKAGE_MAPPER.replace(".", "/");

        PACKAGE_SERVICE = PACKAGE_BASE + "." + (String) PropertiesUtils.getProperties("package.service");

        PATH_SERVICE = PATH_BASE + "/" + PACKAGE_SERVICE.replace(".", "/");

        PACKAGE_SERVICE_IMPL = PACKAGE_BASE + "." + (String) PropertiesUtils.getProperties("package.service.impl");

        PATH_SERVICE_IMPL = PATH_BASE + "/" + PACKAGE_SERVICE_IMPL.replace(".", "/");


        PACKAGE_VO = PACKAGE_BASE + "." + (String) PropertiesUtils.getProperties("package.vo");

        PATH_VO = PATH_BASE + "/" + PACKAGE_VO.replace(".", "/");

        PACKAGE_EXCEPTION = PACKAGE_BASE + "." + (String) PropertiesUtils.getProperties("package.exception");

        PATH_EXCEPTION = PATH_BASE + "/" + PACKAGE_EXCEPTION.replace(".", "/");

        PACKAGE_CONTROLLER = PACKAGE_BASE + "." + (String) PropertiesUtils.getProperties("package.controller");

        PATH_CONTROLLER = PATH_BASE + "/" + PACKAGE_CONTROLLER.replace(".", "/");

    }

    public static void main(String[] args) {
        System.out.println("PACKAGE_CONTROLLER = " + PACKAGE_CONTROLLER);
        System.out.println("PATH_CONTROLLER = " + PATH_CONTROLLER);
        //System.out.println("PATH_PARAM = " + PATH_PARAM);
        //System.out.println("PATH_MAPPER = " + PATH_MAPPER);
        //System.out.println("PACKAGE_BEAN" + PACKAGE_BEAN);

    }
}
